# -*- coding: utf_8 -*-
import time


def timer(func):
    """
    用于计算函数执行时间
    :param func:
    :return:
    """

    def wrapper(*args, **kwargs):
        start_time = time.time()
        res = func(*args, **kwargs)
        exec_time = time.time() - start_time
        print(func.__name__, "函数，花费的时间是:", exec_time)
        return res

    return wrapper


if __name__ == "__main__":
    @timer
    def test():
        """
        :param args:
        :param user: 角色权限
        :return:
        """
        time.sleep(1)
